<?php

namespace app\selladmin\model;

use think\Model;
use think\Db;

/*
 * 店铺
 */

class Itemsimgclass extends Model {

    //项目分类
    public function ItemClass($level,$pagenum) {//$level 1顶级分类 2二级分类 3图片
        if ($level == 1) {
            return $itemclass = Itemsimgclass::where('level=1')->select();
        } elseif ($level == 2) {
            $itemclass = Itemsimgclass::where('level=1')->select();
            for ($i = 0; $i < count($itemclass); $i++) {
                $itemclass[$i]['second'] = Itemsimgclass::where('pid=' . $itemclass[$i]['id'])->select();
            }
            return $itemclass;
        } elseif ($level == 3) {
            $itemclass = Itemsimgclass::where('level=3')->paginate($pagenum);
            return $itemclass;
        }
    }

}
